var a = getApp();

Page({
    data: {
        rid: "",
        redpack_info: {},
        receive_log_list: [],
        page: 1,
        finished: !1,
        customBalance: ""
    },
    onLoad: function(a) {
        var t = a.rid;
        t && this.setData({
            rid: t
        });
        try {
            var e = wx.getStorageSync("yz_basic_info");
            this.setData({
                customBalance: e.balance.balance ? e.balance.balance : "余额"
            });
        } catch (a) {
            console.log(a);
        }
    },
    onShow: function() {
        this.getData();
    },
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.redpack-user.frontend.sendLogDetail.index");
        a._getNetWork({
            url: e,
            data: {
                rid: this.data.rid
            },
            success: function(a) {
                if (1 === a.data.result) {
                    var e = a.data.data, i = !1, s = e.receive_log_list;
                    (t.data.page >= s.last_page || s.data.length < s.per_page) && (i = !0), t.setData({
                        finished: i,
                        page: ++t.data.page,
                        redpack_info: e.redpack_info,
                        receive_log_list: s.data
                    });
                } else wx.showToast({
                    title: a.data.msg
                });
            }
        });
    },
    getMoreData: function() {
        var t = this;
        if (!this.data.finished) {
            var e = a.getNetAddresss("plugin.redpack-user.frontend.sendLogDetail.index");
            a._getNetWork({
                url: e,
                data: {
                    rid: this.data.rid,
                    page: this.data.page
                },
                success: function(a) {
                    if (1 === a.data.result) {
                        var e = !1, i = a.data.data.receive_log_list;
                        (t.data.page >= i.last_page || i.data.length < i.per_page) && (e = !0);
                        var s = t.data.receive_log_list.concat(i.data);
                        t.setData({
                            finished: e,
                            page: ++t.data.page,
                            receive_log_list: s
                        });
                    } else wx.showToast({
                        title: a.data.msg
                    });
                }
            });
        }
    },
    onReachBottom: function() {
        this.getMoreData();
    }
});